package com.candy.control;

import com.candy.service.UserInfoService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/deleteUserInfoById")
public class DeleteUserInfoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        获取前端传递进来的id
        //        接收前端传递进来的参数
        int userId=Integer.parseInt(req.getParameter("id"));
//        调用业务逻辑处理层
        UserInfoService service=new UserInfoService();
        service.deleteUserInfo(userId);
//        转发到查询的映射，更新数据，并进行显示
        req.getRequestDispatcher("/getUserInfoes").forward(req,resp);

    }
}
